package com.example.recyclerviewdemo;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.example.recyclerviewdemo.demo.Demo;
import com.example.recyclerviewdemo.listview.ListViewDemo;
import com.example.recyclerviewdemo.recyclerView.RecyclerViewDemo;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    private Button mListViewDemoBtn, mRecyclerViewDemoBtn, mChatDemoBtn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mListViewDemoBtn = findViewById(R.id.btn_listViewDemo);
        mRecyclerViewDemoBtn = findViewById(R.id.btn_RecyclerViewDemo);

        mChatDemoBtn = findViewById(R.id.btn_chatDemo);

        mListViewDemoBtn.setOnClickListener(this);
        mRecyclerViewDemoBtn.setOnClickListener(this);

        mChatDemoBtn.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent();
        switch (v.getId()) {
            case R.id.btn_listViewDemo:
                intent.setClass(MainActivity.this, ListViewDemo.class);
                startActivity(intent);
                break;
            case R.id.btn_RecyclerViewDemo:
                intent.setClass(MainActivity.this, RecyclerViewDemo.class);
                startActivity(intent);
                break;
            case R.id.btn_chatDemo:
                intent.setClass(MainActivity.this, Demo.class);
                startActivity(intent);
                break;
        }
    }
}
